home *** CD-ROM | disk | FTP | other *** search
- 0 print"[147]":poke53280,0:poke53281,6:poke646,1
- 1 rem
- 2 rem rupert report #23:monkey business
- 3 rem >> weighted keyboard <<
- 4 rem
- 5 print"simulate a monkey at a special"
- 6 print"keyboard with numbers of keys"
- 7 print"in proportion to the frequency of"
- 8 print"each letter's usage in english."
- 9 rem
- 100 data 275," ",130,e,92,t,79,n
- 101 data 76,r,75,o,74,a,74,i,61,s
- 102 data 42,d,36,l,34,h,31,c,28,f
- 103 data 27,p,26,u,25,m,19,y,16,g
- 104 data 16,w,15,v,10,b,5,x,3,q
- 105 data 3,k,2,j,1,z,-1,*
- 185 rem -- pack strings with letters --
- 190 print chr$(147) "total = 0"
- 200 ct=0 : ix=0 : ttl=0
- 210 read n,c$ :nct=0 :if n=-1 then 300
- 220 a$(ix)=a$(ix)+c$
- 230 nct=nct+1 : ct=ct+1 : ttl=ttl+1
- 240 if ct=255 then ct=0 : ix=ix+1
- 250 if nct<n then 220
- 260 print chr$(19)tab(7) ttl : goto 210
- 295 rem -- pick and print letters --
- 300 k=int(rnd(0)*ttl)
- 310 x=int(k/255) : ch=k-x*255+1
- 320 l$=mid$(a$(x),ch,1)
- 330 print l$;
- 340 goto 300
-